//
//  CZHomeButton.swift
//  swiftweibo
//
//  Created by Apple on 15/11/27.
//  Copyright © 2015年 tzw. All rights reserved.
//

import UIKit

class CZHomeButton: UIButton {

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    init(title: String) {
        super.init(frame: CGRectZero)
        // 设置文字的颜色
        setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        // 设置文字
        self.setTitle(title, forState: UIControlState.Normal)
        // 设置图片
        self.setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        self.sizeToFit()
    }
    // 布局子控件
    override func layoutSubviews() {
        super.layoutSubviews()
        titleLabel?.frame.origin.x = 0
        imageView?.frame.origin.x = titleLabel!.frame.size.width + 3
    }

}
